// pages/demo/demo.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    name: "weixin",
    age: 20,
    isTrue: true,
    langs: ["python", "java", "go", "js"],
    dicts: [
      {
        id: 1,
        name: "python"
      },
      { id: 2, name: "go" },
      { id: 3, name: "js" }
    ],
    msg: "",
    localPath: "请选择位置",
    num: 0,
    user:[]
  },
  // 双向绑定
  changeTxt(e) {
    this.setData({ msg: e.detail.value })
  },
  // 获取定位信息
  getLocalPath() {
    // var that = this
    wx.chooseAddress({
      success: (result) => {
        this.setData({ localPath: result.address })
      },
    })
  },
  // 加减运算事件
  clickEvt(e) {
    // console.log(e)
    const dataOperation = e.currentTarget.dataset.operation
    // const dataOperation = e.target.dataset.operation
    console.log(dataOperation)
    this.setData({ num: this.data.num + dataOperation })
  },
  getDataFromSon:function(e) {
    console.log(e)
    this.setData({ user: e.detail })
  }
})